package com.huibei.wateradmin.authority.message;


import com.huibei.wateradmin.authority.domain.User;
import com.huibei.wateradmin.authority.util.DateUtil;

/**
 * Created by wanglinlin on 2016/7/16.
 */
public class ClientUserInfo {
    Long userId;
    String cnName;
    String email;
    String createTime;
    String memberNum;
    String roleName;
    Long roleId;
    Boolean isValid;

    public ClientUserInfo() {
    }

    public ClientUserInfo(User user) {
        this.userId = user.getUserId();
        this.cnName = user.getCnName();
        this.email = user.getEmail();
        this.createTime = DateUtil.dateToString(user.getCreateTime(), "yyyy-MM-dd:HH:mm:ss");
        this.memberNum = user.getMemberNum();
        this.roleName = user.getRole().getDescription();
        this.roleId = user.getRole().getId();
        this.isValid = user.getIsValid();
    }

    public static ClientUserInfo convertToClient(User user) {
        return new ClientUserInfo(user);
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getCnName() {
        return cnName;
    }

    public void setCnName(String cnName) {
        this.cnName = cnName;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getMemberNum() {
        return memberNum;
    }

    public void setMemberNum(String memberNum) {
        this.memberNum = memberNum;
    }

    public String getRoleName() {
        return roleName;
    }

    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }

    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }

    public Boolean getIsValid() {
        return isValid;
    }

    public void setIsValid(Boolean isValid) {
        this.isValid = isValid;
    }
}
